In a typical messaging system, a source machine sends messages across a network connection to a target machine. Before being sent, each message is first written to a log such that in the event of a failure, recovery is possible. The source, having sent a set of messages, writes a PREPARE record to the log before forwarding a PREPARE command on to the target. The PREPARE command informs the target that it may process the set of messages.
As far as the source is concerned, this set of messages is said to be INDOUBT. These messages are no longer the responsibility of the source—processing has been handed over to the target machine. However, the status of such messages is INDOUBT since the source does not yet know whether the messages have been safely received by the target (indeed a message may not have even actually left the source). A copy of the messages is retained at the source and may not be deleted from the source until acknowledgement of safe receipt of the set of messages is received at the source.
If failure of the source occurs before receipt of such an acknowledgement, the PREPARE log record ensures that the source does not attempt to re-process those messages associated with the PREPARE record without first checking with the target what the last set of messages it received were.
A disadvantage with such a solution is that a PREPARE record must be periodically forced to the log by the source (and also by the target upon receipt of the PREPARE). Writing to the log is expensive in terms of latency whilst the disk revolves. Further, whilst waiting for an acknowledgement of receipt of the PREPARE command, the network connection may not be used for other tasks.